<include file="header" />
<script src="/assets/nskj/js/jquery-2.1.0.min.js"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>


<div class="wraper flex-box usercenter col" js="wapjs/base/waterdispenser/js/index">
	<!--<div class="block-space bg-brown">
		<div class="img-box"><img src="/assets/base/waterdispenser/images/small-logo.png"/></div>
	</div>-->
	<div class="full flex-auto flex-box col bg-brown">
		<div class="block-space full flex-box between">
			<div class="img-box"><img src="/assets/base/waterdispenser/images/small-logo.png"></div>
			<div><a href="javascript:void(0)" id="refresh" class="iconfont icon-shuaxin"></a></div>
		</div>
		<div class="logo-box full flex-auto col flex-box">
			<div class="relative_">
				<div id="container"></div>
				<div class="chart-data flex-box col">
					<p class="text-16">{BEESCRM:$money_remain}升</p>
					<p>剩余水量</p>
				</div>
			</div>
			<div class="full flex-box">
				<a href="javascript:void(0)" class="index_btn text-center" id="trigger">扫一扫</a>
				<a href="/nskj/nskj/setting/user_id/{BEESCRM:$user_id}" class="index_btn text-center">切换机型</a>
			</div>
		</div>
	</div>
	<div class="full">
		<div class="tab clearfix text-center">
			<a href="/index.php?g=nskj&m=nskj&a=chooseMoney&user_id={BEESCRM:$user_id}" class="tab-list pull-left">
				<p class="iconfont icon-chongzhi"></p>
				<p>充值</p>
			</a>
			<!--<if condition="$user_type eq 1">
				<a href="/nskj/nskj/maintain/user_id/{BEESCRM:$user_id}/machine_id/{BEESCRM:$machine_id}" class="tab-list pull-left">
					<p class="iconfont icon-lvxin"></p>
					<p>滤芯</p>
				</a>
				<elseif condition="$user_type eq 2"/>
				<a href="/nskj/nskj/setting/user_id/{BEESCRM:$user_id}" class="tab-list pull-left">
					<p class="iconfont icon-lvxin"></p>
					<p>我的</p>
				</a>
			</if>-->
			<a href="/nskj/nskj/maintain/user_id/{BEESCRM:$user_id}/machine_id/{BEESCRM:$machine_id}" class="tab-list pull-left">
				<p class="iconfont icon-lvxin"></p>
				<p>滤芯</p>
			</a>

			<a href="/nskj/nskj/chargelog/user_id/{BEESCRM:$user_id}" class="tab-list pull-left">
				<p class="iconfont icon-jiaoyijilu"></p>
				<p>账户</p>
			</a>
			<a href="/nskj/nskj/customService" class="tab-list pull-left">
				<p class="iconfont icon-kefu"></p>
				<p>客服</p>
			</a>
		</div>
		<input type="hidden" id="per" value="{BEESCRM:$left1_per}"/>
	</div>
</div>
<if condition="$subscribe eq 0">
<div class="pop-box flex-box" id="qrcode"><!--flex-box-->
	<div class="qrcode-box">
		<div class="qrcode"><img src="/assets/base/waterdispenser/images/qrcode_.png"/></div>
		<div class="text-center">
			<p>长按识别二维码</p>
			<p>关注“诺水科技”公众号</p>
		</div>
	</div>
</div>
</if>
<!--<if condition="$user_type eq 1">
	<div class="fixed-box text-center clearfix">
		<a href="#" class="btn actived pull-left">首页</a>
		<a href="/nskj/nskj/setting/user_id/{BEESCRM:$user_id}" class="btn pull-left">我的</a>
	</div>
</if>-->


<script>

    $(function () {
        var url =  window.location.href;
        $.ajax({
            //提交数据的类型 POST GET
            type:"POST",
            //提交的网址
            url:"/nskj/nskj/getSign",
            //提交的数据
            data:{flag:"1",url:url},
            //返回数据的格式
            datatype: "json",//"xml", "html", "script", "json", "jsonp", "text".
            //成功返回之后调用的函数
            success:function(data){
                var data = JSON.parse(data);
                if(data.status=='S'){
                    var appid = data.ress.AppId;
                    var timestamp = data.ress.timeStamp;
                    var nonceStr = data.ress.nonceStr;
                    var signature = data.ress.sign;


                    wx.config({
                        debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
                        appId: appid, // 必填，公众号的唯一标识
                        timestamp: timestamp, // 必填，生成签名的时间戳
                        nonceStr: nonceStr, // 必填，生成签名的随机串
                        signature: signature,// 必填，签名，见附录1
                        jsApiList: ['scanQRCode'] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
                    });






                }else{
                    console.log('error');
                    return 0;
                }

            }   ,
            //调用出错执行的函数
            error: function(){
                //请求出错处理
                alert('error');
            }
        });
    })


	$("#trigger").on('click',function(){

        wx.scanQRCode({
            needResult: 0, // 默认为0，扫描结果由微信处理，1则直接返回扫描结果，
            scanType: ["qrCode","barCode"], // 可以指定扫二维码还是一维码，默认二者都有
            success: function (res) {
                var result = res.resultStr; // 当needResult 为 1 时，扫码返回的结果
            }
        })

	});

</script>


<include file = "footer"/>